package com.workpaper;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

import com.workpaper.app.consts.AppConsts;

public class Perspective implements IPerspectiveFactory {

	@Override	
	public void createInitialLayout(IPageLayout layout) {
		//获取透视图编辑区ID
		String editArea = layout.getEditorArea();
		//隐藏编辑区域
		layout.setEditorAreaVisible(false);
		//固定布局,既不能移动，也不能改变大小
		layout.setFixed(true);
		
//		"功能菜单", SWT.LEFT, ratio, refId
		layout.addStandaloneView(AppConsts.Navigation_VIEW, 
				true, 
				IPageLayout.LEFT,
				0.2F,
				editArea);
		//禁用关闭和移动功能
		layout.getViewLayout(AppConsts.Navigation_VIEW).setCloseable(false);	
		layout.getViewLayout(AppConsts.Navigation_VIEW).setMoveable(false);
		
		//主视图重叠区域： 计划安排、计划执行、计划统计
		IFolderLayout centerLayout = layout.createFolder("centerLayout", IPageLayout.RIGHT, 0.2F, editArea);
		centerLayout.addView(AppConsts.DAILY_PLAN_MANAGE_VIEW);
		layout.getViewLayout(AppConsts.DAILY_PLAN_MANAGE_VIEW).setCloseable(false);	
		layout.getViewLayout(AppConsts.DAILY_PLAN_MANAGE_VIEW).setMoveable(false);
		//工作日报视窗，这里不显示，仅仅是设置占位符，并进行设置，方便后续显示窗口、隐藏窗口
		centerLayout.addPlaceholder(AppConsts.DAILY_WORKPAPER_MANAGE_VIEW);
//		layout.getViewLayout(AppConsts.WORKPAPER_DAILY_MANAGE_VIEW).setCloseable(false);	
		layout.getViewLayout(AppConsts.DAILY_WORKPAPER_MANAGE_VIEW).setMoveable(false);
		
	}
}
